<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/jsplib/pubhead.jsp"%>
<%@ page import="net.comm.param.service.impl.CnpcaServiceImpl" %>
<%@ page import="net.comm.param.bean.BaseCnpca" %>
<%@ page import="java.util.List" %>

<% 
		try {
			request.setCharacterEncoding("UTF-8"); 
			response.setCharacterEncoding("UTF-8"); 
		} catch (Exception e) {
			e.printStackTrace();
		}
		//不缓存页面
		response.setHeader("Cache-Control","no-store");
		response.setHeader("Pragrma","no-cache");
		response.setDateHeader("Expires",0);

		String strPid = request.getParameter("pid");
		String strCid = request.getParameter("cid");
		if(strPid == null || strPid.equals("")){
		
			strPid = "0";
		}
		if(strCid == null || strCid.equals("")){
		
			strCid = "0";
		}

		int ret = 0;

		StringBuffer sb = new StringBuffer(); 
		response.addHeader("Content-Type","text/html"); 
		
//		sb.append("<select name='work_Area' onkeydown='catch_keydown(this);'>");
		sb.append("<option value='0'>请选择</option>");

		CnpcaServiceImpl service = new CnpcaServiceImpl();
				
		//查询条件
		List list = service.getbyCid(Integer.valueOf(strCid));

		if(list.size() > 0){

			int len = list.size();
			BaseCnpca base = new BaseCnpca();

			for(int i=0; i < len; i++){
				base = (BaseCnpca)list.get(i);
				sb.append("<option value=" + base.getId() + " >"); 
				sb.append( base.getName() + "</option>");
			}
		}

		if(ret == 0)
		{
			//服务器返回给login.jsp的response
		}else if(ret == 1)
		{
           sb.append("获取数据库连接错误！");    
		   //服务器返回给login.jsp的response
		}
//		sb.append("</select>");
		
//		System.out.println("s="+ sb.toString());

		response.getWriter().write(sb.toString()); 
		
 %>       
